<template>
	<view class="container">
		<view class="status-bar"></view>
		<block v-if="store!=''">
			<view class="form-group">
				<view class="form-rows">
					<view class="form-row">
						<view class="left">商家名称</view>
						<view class="form-row-hint">{{store.store_name}}</view>
					</view>
					<view class="form-row">
						<view class="left">联系人</view>
						<view class="form-row-hint">{{store.contacts_name}}</view>
					</view>
					<view class="form-row" @click="call_phone(store.contacts_mobile)">
						<view class="left">联系电话</view>
						<view class="form-row-hint">
							<text>{{store.contacts_mobile}}</text>
							<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/goods/store-phone.png"
								mode="widthFix" class="store-phone"></image>
						</view>
					</view>
					<view class="form-row">
						<view class="left">所在地区</view>
						<view class="form-row-hint">{{store.province+store.city+store.district}}</view>
					</view>
					<view class="form-row" @click="goNavigation">
						<view class="left">详细地址</view>
						<view class="form-row-hint">
							<text style="margin-right: 10rpx;">{{store.store_address}}</text>
							<u-icon name="map-fill" color="#2979ff" size="28"></u-icon>
						</view>
					</view>
					<view class="form-row">
						<view class="left">入驻时间</view>
						<view class="form-row-hint">{{store.check_time}}</view>
					</view>
				</view>
			</view>
			<view class="form-group">
				<view class="title">营业执照</view>
				<view class="upload-rows">
					<view class="upload-row" @click="previewImage(1)">
						<image :src="store.business_licence_cert" mode="widthFix" class="upload-img"></image>
					</view>
				</view>
			</view>
			<view class="form-group">
				<view class="title">门头照片</view>
				<view class="upload-rows">
					<view class="upload-row" @click="previewImage(0)">
						<image :src="store.store_logo" mode="widthFix" class="upload-img"></image>
					</view>
				</view>
			</view>
			<view style="height: 0rpx;"></view>
		</block>
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				store: '',
				store_id: 0
			};
		},
		methods: {
			goNavigation() {
				uni.showModal({
					title: "是否导航？",
					success: (res) => {
						if (res.confirm) {
							uni.openLocation({
								latitude: parseFloat(this.store.latitude),
								longitude: parseFloat(this.store.longitude)
							})
						}
					}
				})
			},
			async get_store_detail() {
				const params = {
					store_id: _this.store_id,
				}
				const data = await _this.$post('api/store_xq', params)
				if (data.code == 200) {
					this.store = data.data.store
				} else {
					uni.$u.toast(data.msg)
					setTimeout(() => {
						uni.navigateBack({})
					}, 2000)
				}
			},
			previewImage(index) {
				let arr = [_this.store.store_logo, _this.store.business_licence_cert]
				uni.previewImage({
					urls: arr,
					current: index
				})
			}
		},
		onLoad(e) {
			_this = this;
			if (e.store_id) {
				_this.store_id = e.store_id
			}
			_this.get_store_detail()
		},
		onShow() {

		},
		components: {}
	}
</script>

<style lang="scss" scoped>
	@import "@/static/css/form.scss";

	.container {
		position: relative;
		// padding-top: calc(44px + 20rpx);
		height: 100%;
		// background: url('https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/user/user-bg.png') left top/100% 400rpx no-repeat;
		box-sizing: border-box;

		.form-row {
			display: flex;
			align-items: center;

			&:not(:last-child) {
				border-bottom: $global-border;
			}
		}
	}
</style>